#include<iostream>
#include<string>
using namespace std;




int main()
{
	string a("abcdef");
	string b(a, 2);

	const string c(a);

	for (int i = 0; i < b.size(); i++)
	{
		//cout << b.operator[](i);

		cout << b[i];

	}
	cout << endl;

	////string::iterator st = b.begin();
	//auto st = b.begin();
	//while (st != b.end())
	//{
	//	(*st)++;
	//	st++;
	//}
	//cout << endl;

	//st = b.begin();
	//
	//while (st != b.end())
	//{
	//	cout << *st;
	//	st++;
	//}
	//cout << endl;


	//for (auto& x : b)
	//{
	//	x--;
	//}
	//for (auto x : b)
	//{
	//	cout << x;
	//}


	//string::reverse_iterator st2 = a.rbegin();
	auto st2 = a.rbegin();
	while (st2 != a.rend())
	{
		cout << *st2;
		st2++;
	}
	cout << endl;

	//string::const_iterator st3 = c.begin();
	auto st3 = c.begin();
	while (st3 != c.end())
	{
		cout << *st3;
		st3++;
	}
	cout << endl;


	//string::const_reverse_iterator st4 = c.rbegin();
	auto st4 = c.rbegin();
	while (st4 != c.rend())
	{
		cout << *st4;
		st4++;
	}
	cout << endl;

	cout << "b.size():" << b.size()<<" ";
	cout <<"b.length():" << b.length()<<" ";
	cout << "b.capacity():" << b.capacity() << " ";
	cout << endl;
	//cout << c.max_size();

	b.resize(10);

	cout << "b.size():" << b.size() << " ";
	cout << "b.length():" << b.length() << " ";
	cout << "b.capacity():" << b.capacity() << " ";
	cout << endl;

	/*b.resize(1);
	cout << "b.size():" << b.size() << " ";
	cout << "b.length():" << b.length() << " ";
	cout << "b.capacity():" << b.capacity() << " ";
	cout << endl;*/

	b.reserve(100);

	cout << "b.size():" << b.size() << " ";
	cout << "b.length():" << b.length() << " ";
	cout << "b.capacity():" << b.capacity() << " ";
	cout << endl;

	/*b.clear();
	cout << "b.size():" << b.size() << " ";
	cout << "b.length():" << b.length() << " ";
	cout << "b.capacity():" << b.capacity() << " ";
	cout << endl;*/


	//cout << b.empty();
	
	b.shrink_to_fit();
	cout << "b.size():" << b.size() << " ";
	cout << "b.length():" << b.length() << " ";
	cout << "b.capacity():" << b.capacity() << " ";
	cout << endl;

	/*for (int i = 0; i < b.size(); i++)
	{
		
		cout << b.at(i);

	}*/

	b.push_back('A');
	cout << b;



	cout << endl;

	/*b.append(a,3);
	b.assign(a, 5);*/

	b.insert(0,1,'a');
	b.erase(0, 1);

	/*size_t find = b.find('c');
	while (find != string::npos)
	{
		b.replace(find, 1, "b");
		find = b.find('c', find + 1);

	}*/


	cout << b;
	string s("test.cpp.exe");
	size_t i = s.rfind('.');
	
	string tmp = s.substr(i);
	cout << tmp;


	





	return 0;
}





